home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / SlideShow.java < prev    next >
Encoding:
Java Source  |  1997-02-18  |  6.0 KB  |  147 lines

  1. /*
  2.     A basic extension of the java.applet.Applet class
  3.  */
  4.  
  5. import java.awt.*;
  6. import java.applet.*;
  7. import symantec.itools.awt.*;
  8.  
  9. public class SlideShow extends Applet {
  10.     void invisibleButtonNextUnder_Action(Event event) {
  11.  
  12.  
  13.         //{{CONNECTION
  14.         // Go to the SlideShow's next image
  15.         slideShowPhotos.nextImage();
  16.         //}}
  17.     }
  18.  
  19.     void invisibleButtonPrevUnder_Action(Event event) {
  20.  
  21.  
  22.         //{{CONNECTION
  23.         // Go to the SlideShow's previous image
  24.         slideShowPhotos.previousImage();
  25.         //}}
  26.     }
  27.  
  28.     void slideShowPhotos_SlideChanged(Event event) {
  29.  
  30.         //{{CONNECTION
  31.         // Set the text for WrappingLabel... Get current description
  32.         {
  33.             wrappingLabelDesc.setText(slideShowPhotos.getDescription(slideShowPhotos.getCurrentImageIndex()));
  34.         }
  35.         //}}
  36.     }
  37.  
  38.     void invisibleButtonNext_Action(Event event) {
  39.  
  40.  
  41.         //{{CONNECTION
  42.         // Go to the SlideShow's next image
  43.         slideShowPhotos.nextImage();
  44.         //}}
  45.     }
  46.  
  47.     void invisibleButtonPrev_Action(Event event) {
  48.  
  49.  
  50.         //{{CONNECTION
  51.         // Go to the SlideShow's previous image
  52.         slideShowPhotos.previousImage();
  53.         //}}
  54.     }
  55.  
  56.  
  57.     public void init() {
  58.         super.init();
  59.  
  60.         // Take out this line if you don't use symantec.itools.net.RelativeURL
  61.         symantec.itools.lang.Context.setDocumentBase(getDocumentBase());
  62.  
  63.         //{{INIT_CONTROLS
  64.         setLayout(null);
  65.         resize(531,365);
  66.         setFont(new Font("Dialog", Font.BOLD, 12));
  67.         setForeground(new Color(0));
  68.         setBackground(new Color(16777215));
  69.         invisibleButtonPrevUnder = new symantec.itools.awt.InvisibleButton();
  70.         invisibleButtonPrevUnder.reshape(262,277,37,40);
  71.         add(invisibleButtonPrevUnder);
  72.         invisibleButtonNextUnder = new symantec.itools.awt.InvisibleButton();
  73.         invisibleButtonNextUnder.reshape(305,272,40,44);
  74.         add(invisibleButtonNextUnder);
  75.         slideShowPhotos = new symantec.itools.multimedia.SlideShow();
  76.         try {
  77.             slideShowPhotos.addImageAndDescription(symantec.itools.net.RelativeURL.getURL("Images/PHOTO_1.GIF"), "Pristine Bungbusi beaches are ideal for relaxing and for all kinds of water sports, including surfing, water skiing, and snorkeling.");
  78.             slideShowPhotos.addImageAndDescription(symantec.itools.net.RelativeURL.getURL("Images/Photo_8.gif"), "Hiking through the rainforest and touring botanical gardens are some of the many ways to explore the Bungbusi tropical paradise.");
  79.             slideShowPhotos.addImageAndDescription(symantec.itools.net.RelativeURL.getURL("Images/PHOTO_3.GIF"), "At the top of Venduca volcano, you can safely watch the volcanic activity.");
  80.             slideShowPhotos.addImageAndDescription(symantec.itools.net.RelativeURL.getURL("Images/Photo_7.gif"), "The ocean pounds against rocks formed from past Venduca lava flows.");
  81.             slideShowPhotos.addImageAndDescription(symantec.itools.net.RelativeURL.getURL("Images/PHOTO_2.GIF"), "Who were the technologically advanced people that constructed this ancient Simerilian building? This riddle attracts archeologists and curious travelers from around the world.");
  82.             slideShowPhotos.addImageAndDescription(symantec.itools.net.RelativeURL.getURL("Images/PHOTO_4.GIF"), "The extinct civilization that lived in Simerilia had indoor plumbing, running water, saunas, enclosed courtyards, and sophisticated art in their city buildings.");
  83.             slideShowPhotos.addImageAndDescription(symantec.itools.net.RelativeURL.getURL("Images/PHOTO_5.GIF"), "The beautiful Moderna river slinks through this modern village. Portions of the river are perfect for white-water rafting.");
  84.             slideShowPhotos.addImageAndDescription(symantec.itools.net.RelativeURL.getURL("Images/Photo_6.gif"), "Moderna rose gardens bloom year-round.");
  85.             slideShowPhotos.display();
  86.         } catch (Exception e) {
  87.         }
  88.         slideShowPhotos.reshape(8,8,337,232);
  89.         slideShowPhotos.setFont(new Font("Dialog", Font.BOLD, 12));
  90.         slideShowPhotos.setForeground(new Color(0));
  91.         slideShowPhotos.setBackground(new Color(16777215));
  92.         add(slideShowPhotos);
  93.         imageViewerClicker = new symantec.itools.multimedia.ImageViewer();
  94.         imageViewerClicker.reshape(8,256,381,104);
  95.         add(imageViewerClicker);
  96.         try {
  97.             imageViewerClicker.setURL(symantec.itools.net.RelativeURL.getURL("Images/Clicker.gif"));
  98.         } catch (java.net.MalformedURLException error) {
  99.         }
  100.         invisibleButtonNext = new symantec.itools.awt.InvisibleButton();
  101.         invisibleButtonNext.reshape(305,272,40,41);
  102.         add(invisibleButtonNext);
  103.         invisibleButtonPrev = new symantec.itools.awt.InvisibleButton();
  104.         invisibleButtonPrev.reshape(264,273,35,43);
  105.         add(invisibleButtonPrev);
  106.         wrappingLabelDesc = new symantec.itools.awt.WrappingLabel();
  107.         wrappingLabelDesc.reshape(352,24,175,212);
  108.         add(wrappingLabelDesc);
  109.         wrappingLabelDesc.setText("Pristine Bungbusi beaches are ideal for relaxing and for all kinds of water sports, including surfing, water skiing, and snorkeling.");
  110.         //}}
  111.     }
  112.  
  113.     public boolean handleEvent(Event event) {
  114.         if (event.target == invisibleButtonPrev && event.id == Event.ACTION_EVENT) {
  115.             invisibleButtonPrev_Action(event);
  116.             return true;
  117.         }
  118.         if (event.target == invisibleButtonNext && event.id == Event.ACTION_EVENT) {
  119.             invisibleButtonNext_Action(event);
  120.             return true;
  121.         }
  122.         if (event.target == slideShowPhotos && event.id == Event.ACTION_EVENT) {
  123.             slideShowPhotos_SlideChanged(event);
  124.             return true;
  125.         }
  126.         if (event.target == invisibleButtonPrevUnder && event.id == Event.ACTION_EVENT) {
  127.             invisibleButtonPrevUnder_Action(event);
  128.             return true;
  129.         }
  130.         if (event.target == invisibleButtonNextUnder && event.id == Event.ACTION_EVENT) {
  131.             invisibleButtonNextUnder_Action(event);
  132.             return true;
  133.         }
  134.         return super.handleEvent(event);
  135.     }
  136.  
  137.     //{{DECLARE_CONTROLS
  138.     symantec.itools.awt.InvisibleButton invisibleButtonPrevUnder;
  139.     symantec.itools.awt.InvisibleButton invisibleButtonNextUnder;
  140.     symantec.itools.multimedia.SlideShow slideShowPhotos;
  141.     symantec.itools.multimedia.ImageViewer imageViewerClicker;
  142.     symantec.itools.awt.InvisibleButton invisibleButtonNext;
  143.     symantec.itools.awt.InvisibleButton invisibleButtonPrev;
  144.     symantec.itools.awt.WrappingLabel wrappingLabelDesc;
  145.     //}}
  146. }
  147.